package org.southyin.ioc.test01;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class MyIOC {
    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Properties p = new Properties();
        p.load(MyIOC.class.getClassLoader().getResourceAsStream("myioc.properties"));
        String person = p.getProperty("person");

        Class cls = Class.forName(person);
        Constructor constructor = cls.getConstructor();
        Object obj = constructor.newInstance();

        String method = p.getProperty("method");
        Method method1 = cls.getMethod(method);
        method1.invoke(obj);
    }
}
